import axios from "../plugin/http";
let baseURL = "";
if (process.env.NODE_ENV === 'production') {
  baseURL = 'http://192.144.137.95:13002'
}

//创建投票结果
export function createVoteResult(payload) {
  //payload._id 为vote的id
  return axios
    .post(`${baseURL}/api/result/${payload.id}`, {
      "header": {
        "sysCode": "VOTE_SERVICE",
        "platform": window.navigator.platform,
        "timestamp": new Date().getTime()
      },
      "payload": {
        "selected": payload.selected // [22] 为option选项id数组
      }
    })
}

//获取投票结果
export function getVoteResultById(payload) {
  //payload._id 为vote的id
  return axios
    .get(`${baseURL}/api/result/${payload.id}`)
}

